package reflectdemo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 87111
 * Date: 2025-09-19
 * Time: 17:31
 */
public class TestDemo {
    public static void main(String[] args) {
        //方法一：使用类对象的getClass()方法
        Student student1 = new Student();
        Class<?> c1 = student1.getClass();
        //方法二：通过类名.class获得
        Class<?> c2 = Student.class;
        //方法三：通过Class类里面的forName静态方法获得
        Class<?> c3 = null;
        try {
            c3 = Class.forName("reflectdemo.Studnet");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

    }
}
